package com.software.graduationproject.modules.area.web;


import com.baomidou.mybatisplus.core.metadata.Page;
import com.software.graduationproject.commons.select.Select;
import com.software.graduationproject.commons.util.Result;
import com.software.graduationproject.commons.util.Results;
import com.software.graduationproject.modules.area.object.SysAreaCreateQo;
import com.software.graduationproject.modules.area.object.SysAreaUpdateQo;
import com.software.graduationproject.modules.area.object.SysAreaVo;
import com.software.graduationproject.modules.area.service.SysAreaService;
import com.v2coding.validate.CreateGroup;
import com.v2coding.validate.UpdateGroup;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * SysAreaController : 重庆行政编码
 * ---------------------------------------------------------------------------------------------------------------------
 */
@Validated
@RestController
@RequestMapping("/Sys/SysArea")
@Api(value = "API - 重庆行政编码", tags = {"重庆行政编码接口"})
public class SysAreaController {

    @Autowired
    private SysAreaService sysAreaService;

//    @PostMapping("/create")
//    @ApiOperation("新增重庆行政编码")
//    public Result createQo(@RequestBody @Validated(CreateGroup.class) SysAreaCreateQo qo) {
//        sysAreaService.createQo(qo);
//        return Results.success();
//    }
//
//    @PostMapping("/update")
//    @ApiOperation("修改重庆行政编码")
//    public Result updateQo(@RequestBody @Validated(UpdateGroup.class) SysAreaUpdateQo qo) {
//        sysAreaService.updateQo(qo);
//        return Results.success();
//    }
//
//    @PostMapping("/delete")
//    @ApiOperation("删除重庆行政编码")
//    public Result delete(@RequestBody Long id) {
//        sysAreaService.delete(id);
//        return Results.success();
//    }
//
//    @PostMapping("/deleteList")
//    @ApiOperation("批量删除重庆行政编码")
//    public Result deleteList(@RequestBody Long []ids) {
//        sysAreaService.deleteList(ids);
//        return Results.success();
//    }
//
//    @GetMapping("/select")
//    @ApiOperation("查询重庆行政编码详情")
//    public Result<SysAreaVo> selectVo(Long id) {
//        SysAreaVo sysAreaVo = sysAreaService.selectVo(id);
//        return Results.success(sysAreaVo);
//    }

    @GetMapping("/selectList")
    @ApiOperation("查询重庆行政编码列表")
    @ApiImplicitParams({ //
            @ApiImplicitParam(name = "select", value = "查询条件", required = false, dataTypeClass = String.class, paramType = "query"),//
    })
    public Result<List<SysAreaVo>> selectListVo(@ApiIgnore Select select) {
        List<SysAreaVo> sysAreaVoList = sysAreaService.selectListVo(select);
        return Results.success(sysAreaVoList);
    }

    @GetMapping("/selectPage")
    @ApiOperation("查询重庆行政编码分页")
    @ApiImplicitParams({ //
            @ApiImplicitParam(name = "select", value = "查询条件", required = false, dataTypeClass = String.class, paramType = "query"),//
    })
    public Result<Page<SysAreaVo>> selectPageVo(@ApiIgnore Select select) {
        Page<SysAreaVo> sysAreaVoPage = sysAreaService.selectPageVo(select);
        return Results.success(sysAreaVoPage);
    }


}
